package com.ruoyi.develop.factory.factorySaleOrderColumn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.factory.factorySaleOrderColumn.mapper.FactorySaleOrderColumnMapper;
import com.ruoyi.develop.factory.factorySaleOrderColumn.domain.FactorySaleOrderColumn;
import com.ruoyi.develop.factory.factorySaleOrderColumn.service.IFactorySaleOrderColumnService;

/**
 * 销售订单行项目信息Service业务层处理
 * @author qh
 * @date 2024-11-06
 */
@Service
public class FactorySaleOrderColumnServiceImpl implements IFactorySaleOrderColumnService {
    @Resource
    private FactorySaleOrderColumnMapper factorySaleOrderColumnMapper;

    /**
     * 查询销售订单行项目信息
     * @param id 销售订单行项目信息主键
     * @return 销售订单行项目信息
     */
    @Override
    public FactorySaleOrderColumn selectById(String id) {
        return factorySaleOrderColumnMapper.selectById(id);
    }

    /**
     * 查询销售订单行项目信息列表
     * @param entity 销售订单行项目信息
     * @return 销售订单行项目信息
     */
    @Override
    public List<FactorySaleOrderColumn> selectList(FactorySaleOrderColumn entity) {
        return factorySaleOrderColumnMapper.selectList(entity);
    }

    /**
     * 新增销售订单行项目信息
     * @param entity 销售订单行项目信息
     * @return 结果
     */
    @Override
    public int insert(FactorySaleOrderColumn entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return factorySaleOrderColumnMapper.insert(entity);
    }

    /**
     * 修改销售订单行项目信息
     * @param entity 销售订单行项目信息
     * @return 结果
     */
    @Override
    public int update(FactorySaleOrderColumn entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return factorySaleOrderColumnMapper.update(entity);
    }

    /**
     * 批量删除销售订单行项目信息
     * @param ids 需要删除的销售订单行项目信息主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return factorySaleOrderColumnMapper.deleteByIds(ids);
    }

    /**
     * 删除销售订单行项目信息信息
     * @param id 销售订单行项目信息主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return factorySaleOrderColumnMapper.deleteById(id);
    }
}
